package com.ruoyi.system.service.aid.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.aid.AidWarehouseMapper;
import com.ruoyi.system.domain.aid.AidWarehouse;
import com.ruoyi.system.service.aid.IAidWarehouseService;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;

/**
 * 仓库管理Service业务层处理
 * 
 * @author ruoyi
 */
@Service
public class AidWarehouseServiceImpl implements IAidWarehouseService {
    @Autowired
    private AidWarehouseMapper warehouseMapper;

    /**
     * 查询仓库管理列表
     * 
     * @param warehouse 仓库管理
     * @return 仓库管理
     */
    @Override
    public List<AidWarehouse> selectWarehouseList(AidWarehouse warehouse) {
        return warehouseMapper.selectWarehouseList(warehouse);
    }

    /**
     * 查询所有仓库
     * 
     * @return 仓库列表
     */
    @Override
    public List<AidWarehouse> selectWarehouseAll() {
        return warehouseMapper.selectWarehouseAll();
    }

    /**
     * 通过仓库ID查询仓库信息
     * 
     * @param warehouseId 仓库ID
     * @return 仓库信息
     */
    @Override
    public AidWarehouse selectWarehouseById(Long warehouseId) {
        return warehouseMapper.selectWarehouseById(warehouseId);
    }

    /**
     * 新增仓库
     * 
     * @param warehouse 仓库信息
     * @return 结果
     */
    @Override
    public int insertWarehouse(AidWarehouse warehouse) {
        warehouse.setCreateTime(DateUtils.getNowDate());
        warehouse.setCreateBy(SecurityUtils.getUsername());
        return warehouseMapper.insertWarehouse(warehouse);
    }

    /**
     * 修改仓库
     * 
     * @param warehouse 仓库信息
     * @return 结果
     */
    @Override
    public int updateWarehouse(AidWarehouse warehouse) {
        warehouse.setUpdateTime(DateUtils.getNowDate());
        warehouse.setUpdateBy(SecurityUtils.getUsername());
        return warehouseMapper.updateWarehouse(warehouse);
    }

    /**
     * 删除仓库信息
     * 
     * @param warehouseId 仓库ID
     * @return 结果
     */
    @Override
    public int deleteWarehouseById(Long warehouseId) {
        return warehouseMapper.deleteWarehouseById(warehouseId);
    }

    /**
     * 批量删除仓库信息
     * 
     * @param warehouseIds 需要删除的仓库ID
     * @return 结果
     */
    @Override
    public int deleteWarehouseByIds(Long[] warehouseIds) {
        return warehouseMapper.deleteWarehouseByIds(warehouseIds);
    }

    @Override
    public List<AidWarehouse> selectWarehouseByType(String warehouseType) {
        return warehouseMapper.selectWarehouseByType(warehouseType);
    }

    @Override
    public List<AidWarehouse> selectWarehouseByStatus(String status) {
        return warehouseMapper.selectWarehouseByStatus(status);
    }

    @Override
    public List<AidWarehouse> selectWarehouseByRegion(String region) {
        return warehouseMapper.selectWarehouseByRegion(region);
    }
} 